<?php
/*
|-------------------------------------------------------------------------
| Code Igniter Mini-App, Front Controller Class
| Functionality is Controller to display semi-static pages from view/pages
| 
| add filename.php (w/o head or body tags)
| available as url ./page/filename
|
| Requires following entry in config/routes.php
|
| // route documents from view/pages folder
| $route['page/:any'] = 'front/page';
|
| Copyright (C) 2006  George Dunlop
| Website: http://mini-app.peccavi.com
|-------------------------------------------------------------------------
| 
| This library is free software; you can redistribute it and/or
| modify it under the terms of the GNU Lesser General Public
| License as published by the Free Software Foundation; either
| version 2.1 of the License, or (at your option) any later version.
| 
| This library is distributed in the hope that it will be useful,
| but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
| Lesser General Public License for more details.
| 
| You should have received a copy of the GNU Lesser General Public
| License along with this library; if not, write to the Free Software
| Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
| 
| Last changed:
| 11 Oct '06 George Dunlop, peccavio at peccavi dot com
|
*/

class Front extends Controller {

	function Front()
	{
		parent::Controller();
		//$this->authorize->roleCheck('admin', $this->uri->uri_string());
    $this->lang->load('userauth', $this->session->userdata('ua_language'));
	}
	
	function index()
	{
		$page_req = 'search';
		$this->session->set_flashdata('uri', '');
		$this->_display($page_req);
	}
	
	function page() 
	{
		// get the document request
		$page_req = $this->uri->segment(2);

		// set a url to return to if login
		$this->session->set_flashdata('uri', $this->uri->uri_string());
		$this->_display($page_req);
	}

	// private function, format data to template
	function _display($page_req)
	{
		// Get the content to display
		$data['title'] = $page_req;
		$data['content'] = $this->load->view('pages/'.$page_req,'', TRUE);

		// Get info to steer template menu
		$data['nav'] = $page_req;

		// Display in Template
		$this->load->view('template', $data);
	}
}

?>